/**
 * Created by jiachneyu on 2018/4/20.
 */

const blogData = require("../model/blog/list");
const blogList = async (ctx, next) => {
    await blogData(ctx.query.page).then(res => {
        let returnJson = {};
        if (res.code === 1) {
            returnJson = {
                ...res,
                msg: "查询成功"
            }
        }
        else {
            returnJson = {
                code: -1,
                msg: "查询失败，请重试"
            }
        }
        ctx.body = returnJson;
    });
}

module.exports = [
    {
        method: "get",
        path: "/api/blog/list",
        handle: blogList
    },
    {
        method: "get",
        path: "/api/admin/list",
        handle: blogList
    }
]